package com.demo.controller.admin;

import com.demo.common.constant.DictKeys;
import com.demo.common.model.Article;
import com.demo.common.model.AuthUser;
import com.demo.controller.BaseController;
import com.jfinal.core.Controller;

public class AuthUserController extends BaseController<AuthUser>{
	
	public void index(){
		
		renderJson(AuthUser.me.paginate(1, 10));
	}
	public void getById(){
		setAttr("article", Article.me.findById(getParaToInt()));
		render("/article.html");
	}
	//获取登录信息
	public void getUserById(){
		AuthUser loginInfo = new AuthUser();
		AuthUser user = getSessionAttr(DictKeys.SESSION_ADMIN_USER);
		loginInfo.set("last_loginip", user.getLastLoginip());
		loginInfo.set("last_login", user.getLastLogin());
		loginInfo.set("login_times", user.getLoginTimes());
		renderJson(loginInfo);
	}

}
